package fun.codedesign.datasource.spring.boot.autoconfigure;

public class TenantContextHolder {

    public static final String DEFAULT_DATASOURCE = "default";
    public static final String TENANT_DATASOURCE = "tenant";

    ThreadLocal<String> threadLocal = ThreadLocal.withInitial(() -> DEFAULT_DATASOURCE);

    public static String getTenant() {
        // TODO 线程上下文
        if (true) {
            return TENANT_DATASOURCE;
        }
        return DEFAULT_DATASOURCE;
    }

    public static void setTenant() {
        // TODO ThreadLocal实现
    }
}
